x86/vm_event: add short-circuit for breakpoints (aka "fast single step")
authorSergey Kovalev <valor@list.ru>
Fri, 20 Dec 2019 15:45:32 +0000 (16:45 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 Dec 2019 15:45:32 +0000 (16:45 +0100)
commitf801b40d20c01eb41bed3157e266a18d34260259
treeacf2513f3e443a6cd7e7a25ea20e0f4a655e7512
parentf9dee1f945ebb6fb5f9df6f5d95b15c25727f48e
x86/vm_event: add short-circuit for breakpoints (aka "fast single step")

When using DRAKVUF (or another system using altp2m with shadow pages similar
to what is described in
https://xenproject.org/2016/04/13/stealthy-monitoring-with-xen-altp2m),
after a breakpoint is hit the system switches to the default
unrestricted altp2m view with singlestep enabled. When the singlestep
traps to Xen another vm_event is sent to the monitor agent, which then
normally disables singlestepping and switches the altp2m view back to
the restricted view.

This patch short-circuiting that last part so that it doesn't need to send the
vm_event out for the singlestep event and should switch back to the restricted
view in Xen automatically.

This optimization gains about 35% speed-up.

Was tested on Debian branch of Xen 4.12. See at:
https://github.com/skvl/xen/tree/debian/knorrie/4.12/fast-singlestep

Rebased on master:
https://github.com/skvl/xen/tree/fast-singlestep

Signed-off-by: Sergey Kovalev <valor@list.ru>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/monitor.c
xen/arch/x86/vm_event.c
xen/include/asm-x86/hvm/hvm.h
xen/include/asm-x86/hvm/vcpu.h
xen/include/public/vm_event.h